package com.chuang.bootplus.controller;


import com.chuang.bootplus.base.utils.ApiResponse;
import com.chuang.bootplus.po.topic.TopicCommentListPO;
import com.chuang.bootplus.po.topic.TopicCommentSavePO;
import com.chuang.bootplus.service.TopicCommentService;
import com.chuang.bootplus.vo.TopicCommentVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2021-08-17
 */
@RestController
@RequestMapping("/topic-comment")
@Api(tags = "碳圈 评论")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class TopicCommentController {
    final TopicCommentService topicCommentService;

    @PostMapping("comment")
    @ApiOperation("添加评论")
    public ApiResponse<Void> save(@RequestBody TopicCommentSavePO po){
        return topicCommentService.save(po);
    }

    @PostMapping("list")
    @ApiOperation("获取评论列表")
    public ApiResponse<TopicCommentVO> save(@RequestBody TopicCommentListPO po){
        return topicCommentService.list(po);
    }
}

